package pers.cyril.jdb.client.sender;

import io.netty.channel.Channel;
import pers.cyril.jdb.protocol.packet.LoginRequestPacket;

import java.util.Scanner;

/**
 * 文件描述
 *
 * @author yichao wang
 */
public class ConsoleLoginSender implements ConsoleCommandSender {
    public static final ConsoleLoginSender INSTANCE = new ConsoleLoginSender();
    private Scanner scanner = new Scanner(System.in);
    @Override
    public void send(Channel channel) {
        System.out.println("pls input usename：");
        String username = scanner.nextLine();
        System.out.println("pls input password：");
        String password = scanner.nextLine();
        LoginRequestPacket packet = new LoginRequestPacket();
        packet.setUsername(username);
        packet.setPassword(password);
        channel.writeAndFlush(packet);
    }
}
